<template>
	<view class="footer-btn-box">
		<view class="fixed-content">
			<view class="footer-btn-slot">
				<slot class=""></slot>
			</view>
			<!-- 安全区 -->
			<view class="footer-safe-area-inset-bottom"></view>
		</view>
		<!-- 高度 -->
		<view class="footer-btn-height" :style="{height: height + 'px'}"></view>
	</view>
</template>

<script>
	export default {
		name:'FooterBtn',
		data() {
			return {
				height: 0
			}
		},
		mounted() {
			uni.createSelectorQuery().in(this).select('.footer-btn-slot').boundingClientRect(res=>{
				this.height = res.height + uni.upx2px(24)
			}).exec()
		}
	}
</script>

<style lang="scss" scoped>
	.footer-btn-box{
		.fixed-content{
			position: fixed;
			bottom: 0;
			left: 0;
			width: 100%;
			border-top: 1rpx solid #F8F9FA;
			z-index: 99;
			background: #fff;
			.footer-btn-slot{
				padding: 16rpx 24rpx;
			}
		}
		.footer-safe-area-inset-bottom{
			height: calc(constant(safe-area-inset-bottom) - 16rpx);///兼容 IOS<11.2/
			height: calc(env(safe-area-inset-bottom) - 16rpx);///兼容 IOS>11.2/
		}
	}
	.footer-btn-height{
		box-sizing: initial;
		padding-bottom: calc(constant(safe-area-inset-bottom) - 16rpx);///兼容 IOS<11.2/
		padding-bottom: calc(env(safe-area-inset-bottom) - 16rpx);///兼容 IOS>11.2/
	}
</style>
